<script setup>
import { ref } from 'vue'
import LoginQr from './components/LoginQr.vue'
import LoginPhone from './components/LoginPhone.vue'
import RegisterAccount from './components/RegisterAccount.vue'

const activeName = ref('QRCode')

</script>

<template>
  <div class="login">
    <div class="bg">
      <span></span>
      <span></span>
      <span></span>
    </div>
    <div class="login-container">
      <el-tabs v-model="activeName" class="demo-tabs" :stretch="true">
        <el-tab-pane label="二维码登录" name="QRCode">
          <LoginQr v-if="activeName === 'QRCode'" />
        </el-tab-pane>
        <el-tab-pane label="账号登录" name="second">
          <LoginPhone />
        </el-tab-pane>
        <el-tab-pane label="注册或修改密码" name="validateCode">
          <RegisterAccount />
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<style scoped lang='scss'>
.login {
  height: 100vh;
  width: 100%;
  background-image: url('@/assets/image/login-bg.jpg');
  background-position: center;
  background-size: cover;
  display: flex;
  align-items: center;

  .bg {
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -150px;
    margin-top: -150px;
    height: 300px;
    width: 300px;
    animation: am2 ease-out 1s;

    span {
      position: absolute;
      right: 50%;
      bottom: 50%;
    }

    span:nth-child(1) {
      margin-right: -240px;
      margin-bottom: 150px;
      height: 100px;
      width: 100px;
      border-radius: 50%;
      background-color: yellow;
      animation: am1 ease-in-out 1.5s infinite alternate-reverse;
    }

    span:nth-child(2) {
      margin-right: 190px;
      margin-bottom: 65px;
      height: 100px;
      width: 100px;
      border-radius: 50%;
      background-color: $sucColor;
      animation: am1 ease-in-out 2.5s infinite alternate-reverse;
    }

    span:nth-child(3) {
      margin-right: -340px;
      margin-bottom: -400px;
      height: 200px;
      width: 200px;
      border-radius: 50%;
      background-color: $primaryColor;
      animation: am1 ease-in-out 4s infinite alternate-reverse;
    }

    @keyframes am1 {
      0% {
        transform: translateY(0);
      }

      100% {
        transform: translateY(-30px);
      }
    }

    @keyframes am2 {
      0% {
        transform: scale(0, 0) rotateZ(60deg);
      }

      100% {
        transform: scale(1, 1) rotateZ(0);
      }
    }
  }

  .login-container {
    position: relative;
    width: 500px;
    height: 600px;
    margin: 0 auto;
    box-shadow: inset 1px 1px 6px rgb(210, 210, 210), 0px 0px 6px #a5a5a5;
    border-radius: 10px;
    backdrop-filter: blur(4px);
  }

  a {
    text-align: center;
  }

  :deep(.el-tabs__item) {
    height: 60px;
    font-size: 16px;
    font-weight: bold;
  }
}
</style>